const remarkAttr = require('remark-attr');

module.exports = {
  siteMetadata: {
    title: `小二柴`,
    description: `javasscript web 前端 React技术栈`,
    author: `@slience`,
  },
  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `markdown`,
        path: `${__dirname}/markdown`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: "gatsby-remark-attr",
            options: {
              allowDangerousDOMEventHandlers: true,
              enableAtxHeaderInline: true,
              elements: [
                ...remarkAttr.SUPPORTED_ELEMENTS,
                'table',
              ]
            },
          },
        ]
      },
    },
    `gatsby-plugin-dark-mode`,
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    `gatsby-plugin-offline`,
    {
      resolve: `gatsby-plugin-less`,
      options: {
        cssLoaderOptions: {
          // 项目中使用的css-loader为@1.0.1
          modules: true,
          localIdentName: '[name]__[local]__[hash:base64:5]',
        },
        postCssPlugins: [require(`postcss-preset-env`)({ stage: 0 })]
      },
    },
  ],
};
